<div class="content-form edit-aluno">
    
    <h2><?php echo $this->titulo; ?></h2>
    
    <?php echo $this->partial('aluno/menu.phtml', array('urlfoto'=>$this->urlfoto,'modulo'=>$this->modulo,'controller' => $this->controller, 'action' => $this->action, 'data' => $this->data)); ?>

    <div class="content-form">
        <h2>Galeria de Fotos</h2>
        <div class="glr-btn">
            <i>Adicionar Fotos</i>
            <span class="btn btn-success fileinput-button">
                +<input id="fileupload" type="file" name="files[]" multiple />
            </span>
            <div id="progress" class="progress" style="display: none;">
                <div class="progress-bar progress-bar-success"></div>
            </div>
            <?php // <div id="files" class="files"></div> ?>
        </div>
        <input type="hidden" id="ALU_ID" name="ALU_ID" value="<?php echo $this->data['ALU_ID']; ?>" /> 
        <div id="container" class="cnt_list_gl" style="width: 595px;height: 595px;"> <? // style="width: 500px" ?>
        <?php 
            foreach ($this->result as $row) {
                
                $src = 'public/upload/'.$this->controller.'/'.$row['GAL_IDIMG'];
                        
                //$imgs = glob('public/upload/'.$this->controller.'/'.$this->data['ALU_ID'].'_g_*_tb.*');
                //asort($imgs);
                //foreach ($imgs as $key => $src) {
                
                    $tam_img = getimagesize($src);

                    //if($tam_img[0] == '196') $item = 'pqn';//$tam = 196;
                    //else $item = 'gnd';//$tam = 394;

                    $nome = end(explode('/', $src));
                    $nome = explode('.', $nome);
                    $id = str_replace('_tb', '',$nome[0]);
 
                    if(!isset($arr_img[$id])){
                    ?>
                    <div id="cnt_gl_<?php echo $id; ?>" class="cnt_gl item <?php echo $item;?>">
                        <div class="cnt_btn">
                            <ul class="ui-widget ui-helper-clearfix">
                                <li id="<?php echo $row['GAL_IDIMG']; ?>" class="ui-state-highlight ui-corner-all nom_foto" title="Nome">
                                    <input class="nom_gal" type="text" value="<?php echo $row['GAL_NOM']; ?>" <?php // readonly="" ?> >
                                </li>
                                <li title="Excluir" class="ui-state-error ui-corner-all del_foto" id="<?php echo $id; ?>" src="<?php echo $this->urlbase.'/'.$src; ?>" ><span class="ui-icon ui-icon-closethick"></span></li>
                            </ul>
                        </div>
                    <?php echo '<a href="'.$this->urlbase.'/'.str_replace('_tb.', '.',$src).'" data-lightbox="roadtrip" /><img title="" src="'.$this->urlbase.'/'.$src.'" /></a>'; ?>
                    </div>
                    <?php
                    }
                //}
            }
        ?>
        </div>

            
        <?php echo $this->paginationControl($this->paginator, 'Sliding', 'pagination.phtml'); ?>
        
    </div>
    
</div>

<script src="<?php echo $this->urlbase.'/public/media/js/masonry.pkgd.min.js'?>"></script>
<?php /*
<script> 
$(function(){

    //var container = document.querySelector('#container');
    //var msnry = new Masonry( container, {
    $('#container').masonry({
      itemSelector: '.item',
      columnWidth: 1
    });
    
    
}); 
</script>
*/ ?>
<link  href="<?php echo $this->urlbase.'/public/media/js/lightbox/css/lightbox.css' ?>" rel="stylesheet" media="screen"/>
<script src="<?php echo $this->urlbase.'/public/media/js/lightbox/js/modernizr.custom.js' ?>"></script>
<script src="<?php echo $this->urlbase.'/public/media/js/lightbox/js/lightbox-2.6.min.js' ?>"></script>

<?php /* <link rel="stylesheet" href="<?php echo $this->urlbase.'/public/media/js/multiupload/css/bootstrap.min.css'; ?>"> */ ?>
<link rel="stylesheet" href="<?php echo $this->urlbase.'/public/media/js/multiupload/css/font-awesome.css'; ?>">
<link rel="stylesheet" href="<?php echo $this->urlbase.'/public/media/js/multiupload/css/jquery.fileupload-ui.css'; ?>" />

<script src="<?php echo $this->urlbase.'/public/media/js/multiupload/'; ?>js/vendor/jquery.ui.widget.js"></script>
<script src="<?php echo $this->urlbase.'/public/media/js/multiupload/'; ?>js/jquery.iframe-transport.js"></script>
<script src="<?php echo $this->urlbase.'/public/media/js/multiupload/'; ?>js/jquery.fileupload.js"></script>
<script>
$(function () {
    'use strict';
    // Change this to the location of your server-side upload handler:
    var url = '<?php echo $this->urlbase.'/public/media/js/multiupload/server/php/'; ?>';
    $('#fileupload').fileupload({
        url: url,
        dataType: 'json',
        done: function (e, data) {
            $.each(data.result.files, function (index, file) {
                $('<p/>').text(file.name).appendTo('#files');
            });
        },
        progressall: function (e, data) {
            var progress = parseInt(data.loaded / data.total * 100, 10);
            $('#progress .progress-bar').css(
                'width',
                progress + '%'
            );
            modal()
            if(progress == 100) setTimeout(function(){ window.location.reload(); },5000);
        }
    }).prop('disabled', !$.support.fileInput)
        .parent().addClass($.support.fileInput ? undefined : 'disabled');
});
</script>
<div id="dialog" style="display: none;">
    <label><input type="radio" class="tamanho_foto" name="tamanho_foto" value="1" /> Tamanho Normal </label><br>
    <label><input type="radio" class="tamanho_foto" name="tamanho_foto" value="2" /> Tamanho Horizontal </label><br>
    <label><input type="radio" class="tamanho_foto" name="tamanho_foto" value="3" /> Tamanho Vertical </label><br>
    <label><input type="radio" class="tamanho_foto" name="tamanho_foto" value="4" /> Tamanho Grande </label><br>
    <br>
    <input type="hidden" id="edit_id" value="" />
    <a href="javascript:void(0)" class="btn-dlg config_foto">editar</a> 
    
</div>